/**
 * teComponents Package initially created by Dagny Jackson
 * includes the initial elements:
 * teJButton
 * teJComboBox
 * teJFrame
 * teJLabel
 * teJLabelWarning
 * teJList
 * teJScrollBar
 * teJScrollPane
 * teJTable
 * teJTexfield
 * 
 */

package teComponents;

import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.border.BevelBorder;

public class teJList extends JList 
{
	//private DefaultComboBoxModel jList1Model;
	private DefaultListModel jList1Model;
	
	public teJList() 
	{
		super();
		jList1Model= new DefaultListModel ();
		this.setModel(jList1Model);
		initGUI();
	}
	
	//vector constructor created using Lidiya's method
	public teJList(Vector<String> lst) 
    {
		super();
		//jList1Model = new DefaultComboBoxModel(lst);
		jList1Model= new DefaultListModel ();
		this.setModel(jList1Model);
		initGUI();
    }
	
	
	private void initGUI() 
	{
		try 
		{
			this.setBounds(120, 89, 249, 225);
			this.setForeground(new java.awt.Color(43,32,3));
			this.setBackground(new java.awt.Color(255,255,255));
			this.setSelectionBackground(new java.awt.Color(2,234,231));
			this.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, new java.awt.Color(147,188,12), new java.awt.Color(243,250,218), new java.awt.Color(92,69,5), new java.awt.Color(92,69,5)));
			this.setFont(new java.awt.Font("Abyssinica SIL",1,12));
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
		}
	}
    
	public void setErrorBgd()
	{
		this.setForeground(new java.awt.Color(198,42,3));
	  	this.setSelectionBackground(this.getBackground());
	  	this.setFocusable(false);
	}
	
	public void setWorkingBgd()
	{
		this.setForeground(new java.awt.Color(43,31,2));
		this.setSelectionBackground(new java.awt.Color(2,234,231));
		this.setFocusable(true);
	}
	
	public DefaultListModel getjListModel() {
		return jList1Model;
	}

	public void setjList1Model(DefaultListModel jList1Model) {
		this.jList1Model = jList1Model;
	}
	public void addElem(Object elm)
	{
		
	  getjListModel().addElement(elm);
	}
	public void clrList()
	{
		getjListModel().clear();
		
	}
	public Object removeElm(int index)
	{
		
		return(getjListModel().remove(index));
		
	}
	public int getListSize()
	{
		return (getjListModel().getSize());
	}
}
